<template>
    <div>
        <h1 style="text-align:center;">
            查看账号
        </h1>
        <!--新增界面-->
			<el-form label-width="70px" ref="form"  :model="form" >
				<el-form-item label="用户名" >
                    {{form.username}}
				</el-form-item>
				<el-form-item label="密码" prop="password">
                    <span>{{form.password}}</span>
				</el-form-item>
                <el-form-item label="用户类型">
                    <span> {{form.level}}级用户</span>
                </el-form-item>
				<el-form-item label="手机号" prop="phone">
                    <span>{{form.phone}}</span>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
               <el-button  type="primary" @click.native="edit()">修改</el-button>
			</div>
    </div>
</template>
<script>
let  data;
export default {
    data(){
      return{
        addLoading: false,
        //界面数据
        form: {
            username:'',
			phone:'',
            password:'',
            level:''
        }
      }  
    },
     created(){
        data = JSON.parse(sessionStorage.getItem('data'));
        this.form =  {
            username:data['name'],
			phone:data['phone'],
            password:data['password'],
            level:data['level']
        }
    },
    mounted(){
        this.getLevel();
    },
	methods:{
        edit(){
            this.$router.push('/editaccount');
        },
       getLevel(){
            switch(this.form.level){
                case 1:
                    this.form.level = '一';
                break;
                case 2:
                    this.form.level = '二';
                break;
                case 3:
                    this.form.level = '三';
                break;
            }
        }
	}
  
}
</script>
<style lang="scss" scoped>
.content-wrapper>div{
	width: 380px;
	position: absolute;
	top:50%;
	left: 50%;
	margin: -200px 0 0 -100px;
	padding: 20px;
	border: 1px solid #eaeaea;

    .el-form-item{
        text-align: center;
    }
	.dialog-footer{
		text-align: center;
	}
}
</style>
